package com.vcc.service.client.vo.rechargeLog;

import com.vcc.data.entity.RechargeLog;
import com.vcc.service.client.vo.baseVo.BaseVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;

@EqualsAndHashCode(callSuper = true)
@Data
@Setter
@Getter
public class RechargeLogVo extends BaseVo implements Serializable {
    private Long userId;
    private String account;
    private String dealerAccount;
    private String orderId;
    private String remark;
    private Integer useFlag;
    private Integer status;
    private Long currencyId;
    private String currencyCode;
    private String img;
    private BigDecimal amount;
    private Date requestDate;
    private Date auditDate;
    private Long auditUserId;
    private String auditUserAccount;
    private String remittanceCurrency;
    private BigDecimal remittanceAmount;
    private BigDecimal remittanceRate;
    private String remittanceAddress;
    private String rechargeAddress;
    private String voucher;
    private String auditRemark;

    public RechargeLogVo() {
    }


    public RechargeLogVo(RechargeLog rechargeLog, String account, String dealerAccount, String auditAccount) {
        super.setId(rechargeLog.getId());
        this.userId = rechargeLog.getUserId();
        this.account = account;
        this.dealerAccount = dealerAccount;
        this.orderId = rechargeLog.getOrderId();
        this.remark = rechargeLog.getRemark();
        this.useFlag = rechargeLog.getUseFlag();
        this.status = rechargeLog.getStatus();
        this.currencyId = rechargeLog.getCurrencyId();
        this.currencyCode = rechargeLog.getCurrencyCode();
        this.amount = rechargeLog.getAmount();
        this.requestDate = rechargeLog.getRequestDate();
        this.auditDate = rechargeLog.getAuditDate() != null ? rechargeLog.getAuditDate() : null;
        this.auditUserId = rechargeLog.getAuditUserId() != null ? rechargeLog.getAuditUserId() : 0L;
        this.auditUserAccount = auditAccount != null ? auditAccount : "";
        this.remittanceAmount = rechargeLog.getRemittanceAmount();
        this.remittanceCurrency = rechargeLog.getRemittanceCurrency();
        this.remittanceRate = rechargeLog.getRemittanceRate() != null ? rechargeLog.getRemittanceRate().setScale(2, RoundingMode.HALF_UP) : BigDecimal.ZERO;
        this.remittanceAddress = rechargeLog.getRemittanceAddress();
        this.rechargeAddress = rechargeLog.getRechargeAddress();
        this.voucher = rechargeLog.getVoucher();
        this.auditRemark = rechargeLog.getAuditRemark();

    }

}
